﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HiLand.Utility.Drawing;
using System.IO;
using HiLand.Utility.IO;

namespace WebDemo
{
    public partial class ThumbnailDemo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string fileToOperate = this.MapPath("~/Downs/fileToDown.jpg");
            Stream stream= Thumbnail.MakeThumbnail(fileToOperate,200,300, ThumbnailCutModes.H);
            FileHelper.WriteStreamToFile(stream,"C:\\"+ Guid.NewGuid().ToString()+".jpg");
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            string fileToOperate = this.MapPath("~/Downs/fileToDown.jpg");
            Stream stream = Thumbnail.MakeThumbnail(fileToOperate, 200, 300, ThumbnailCutModes.W);
            FileHelper.WriteStreamToFile(stream, "C:\\" + Guid.NewGuid().ToString() + ".jpg");
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            string fileToOperate = this.MapPath("~/Downs/fileToDown.jpg");
            Stream stream = Thumbnail.MakeThumbnail(fileToOperate, 200, 300, ThumbnailCutModes.HW);
            FileHelper.WriteStreamToFile(stream, "C:\\" + Guid.NewGuid().ToString() + ".jpg");
        }

        protected void Button4_Click(object sender, EventArgs e)
        {
            string fileToOperate = this.MapPath("~/Downs/fileToDown.jpg");
            Stream stream = Thumbnail.MakeThumbnail(fileToOperate, 200, 300, ThumbnailCutModes.Auto);
            FileHelper.WriteStreamToFile(stream, "C:\\" + Guid.NewGuid().ToString() + ".jpg");
        }
    }
}